<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/core" prefix="c"%>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<script type="text/javascript" src="js/jquery-1.8.min.js"></script>
<link rel="stylesheet" href="css/jquery-ui.css" type="text/css"/>
<script>
			$(document).ready(function(){
				var startDateInput=document.getElementById("datepicker");

				var currentDay = new Date();
				var month=(currentDay.getMonth()+1)+"";
				month=(month<10)?"0"+month:month+"";
				var day=(currentDay.getDate()<10)?"0"+currentDay.getDate()+"":currentDay.getDate()+"";
				var theDate =  day + '/' + month + '/' +currentDay.getFullYear();
				
				$("#datepicker").val(theDate);
				
			});
			
			$(function() {
				$( "#datepicker" ).datepicker({
					changeMonth: true,
					changeYear: true,
					yearRange:"c-10",
					minDate:"-10y",
					dateFormat: 'dd/mm/yy',
					});
			});
			
</script>	
<div style="display: inline-block;">
	<div class="view" style="display: inline-block;">
		<html:form action="/getReports">
			<div class="ctable">
				<div class="cfilter label" style="margin-bottom: 10px;"><bean:message key="reports.date"/>:</div>
				<div class="cfilter field" style="margin-bottom: 10px;">
					<html:text styleId="datepicker" property="siloFilterView.date" style="height: 12px;padding-left: 2px;width: 59px;" maxlength="10" size="10" styleClass="textfields" readonly="true"/>
				</div>
				<div class="cfilter field" style="margin-bottom: 10px;">
					<html:submit styleClass="boton"><bean:message key="reports.search"/></html:submit>
					<html:button onclick="location.href = 'welcome.do';" styleClass="boton" property="back"><bean:message key="reports.back"/></html:button>
				</div>
				<div class="cfilter label" style="margin-bottom: 10px;">
					<c:if test="${! empty SiloForm.siloMovementsViews}">
						<html:link action="/getExcelReports" styleClass="botonNormal content" paramName="SiloForm" paramProperty="siloFilterView.date" paramId="dateParam" ><img style="margin-top: -1px;" border="0" src="img/icon_excel.gif"></html:link>
					</c:if>
				</div>
			</div>
		</html:form>
		<div class="ctable">
			<table  class="ctable" style="width:100%;" cellSpacing="1" cellPadding="0" border="0" bgcolor="#CCCCCC">
			    <tr> 
		            <td class="titcolumna" align="center"> <bean:message key="reports.shipping"/> </td>
		            <td class="titcolumna" align="center"> <bean:message key="reports.wagon"/> </td>
		            <td class="titcolumna" align="center"> <bean:message key="reports.movements"/> </td>
		            <td class="titcolumna" align="center"> <bean:message key="reports.tanks"/> </td>
		            <td class="titcolumna" align="center"> <bean:message key="reports.location"/> </td>
		            <td class="titcolumna" align="center"> <bean:message key="reports.amount"/> </td>
		            <td class="titcolumna" align="center"> <bean:message key="reports.cornType"/> </td>
		            <td class="titcolumna" align="center"> <bean:message key="reports.wetness"/> </td>
		            <td class="titcolumna" align="center"> <bean:message key="reports.originAmount"/> </td>
		            <td class="titcolumna" align="center"> <bean:message key="reports.origin"/> </td>
		         </tr>
				<c:forEach var="siloMovementsView" items="${SiloForm.siloMovementsViews}" varStatus="index">
					<tr class="<c:choose><c:when test="${index.count%2==0}">odd</c:when><c:otherwise>even</c:otherwise></c:choose>">
						<td width="250" align="center" class="marco"><c:out value="${siloMovementsView.shipping}"/></td>
						<td width="250" class="marco" align="left"><c:out value="${siloMovementsView.wagon}"/></td >
						<td width="250" class="marco" align="center"><c:out value="${siloMovementsView.movements}"/></td >
						<td width="250" class="marco" align="center"><c:out value="${siloMovementsView.tanks}"/></td >
						<td width="250" class="marco" align="center"><c:out value="${siloMovementsView.locationView.locationId}"/></td >
						<td width="250" class="marco" align="right"><c:out value="${siloMovementsView.amount}"/></td >
						<td width="500" class="marco" align="left"><c:out value="${siloMovementsView.cornType}"/></td >
						<td width="250" class="marco" align="right"><c:out value="${siloMovementsView.wetness}"/></td >
						<td width="250" class="marco" align="right"><c:out value="${siloMovementsView.originAmount}"/></td >
						<td width="250" align="center" class="marco"><c:out value="${siloMovementsView.origin}"/></td>
					</tr>
				</c:forEach>
			</table>
		</div>
</div>
</div>